<?PHP
date_default_timezone_set("Asia/Chongqing");
include("../public/common.php");
include("../config/connect.php");

$userid = CheckUrlParamNoDie("userid");
//$tbid = CheckUrlParamNoDie("tbid");

if ($userid != "")
{
	$sql = "select count(*) as tmp from user where commend_id='$userid'";
	$qs = mysql_query( $sql );
	$num_rows = mysql_result($qs, 0, "tmp");
	
	$sql = "SELECT count(*) as tmp1, sum(real_pay_fee) as tmp2, sum(commission) as tmp3 FROM `order_handle_report` where user_id=$userid"; 
	$qs = mysql_query( $sql );
	$row = mysql_fetch_assoc( $qs );
	
	$all_buy_count = $row["tmp1"] ? $row["tmp1"] : 0;
	$all_pay = $row["tmp2"] ? $row["tmp2"] : 0;
	$all_commission = $row["tmp3"] ? $row["tmp3"] : 0;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="font-size:12px;">
该用户共购物&nbsp;<b><?PHP echo $all_buy_count; ?></b>&nbsp;笔，购物总额为&nbsp;<b><?PHP echo $all_pay; ?></b>&nbsp;元，共返现了&nbsp;<b><?PHP echo round($all_commission*0.6,2); ?></b>&nbsp;元；<br />该用户共推荐了&nbsp;<b><?PHP echo $num_rows; ?></b>&nbsp;人。
</body>
</html>
